myApp.controller('addMachineController', function ($scope, $uibModal, $stateParams, ngDialog, $http, $filter, $interval, $timeout, $rootScope) {
    $scope.info = {};

    $scope.info.validate = true;

    $scope.info.machine = {};

    $scope.save = function () {
        $scope.info.machine.token_id = getTokenId();
        $http.post(ucloud_master_url + '/api/v1/machine/add', $scope.info.machine).success(function (data) {
            if (data.success) {
                alert('添加成功');
                $scope.goback();
            } else {
                alert(data.msg);
            }
            ;
        }).error(function (data) {
            alert(JSON.stringify(data.messages))
        });
    };

    $scope.goback = function () {
        window.location.href = '#/menu/machinelist/';
    }
});